$.fn.extend({

    dialog:function(params){
        if(typeof(params)=="object"){
            var html = ' <div class="modal fade" id="modal-id" data-backdrop="static">\
                            <div class="modal-dialog" >\
                                <div class="modal-content">\
                                    <div class="modal-header">\
                                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>\
                                         <h4 class="modal-title"></h4>\
                                    </div>\
                                    <div class="modal-body"></div>\
                                    <div class="modal-footer">\
                                        <button type="button" class="btn btn-default" data-dismiss="modal">返回</button>\
                                         <button type="button" class="btn btn-primary site-demo-layedit" data-type="content">确定</button>\
                                    </div>\
                                </div>\
                            </div>\
                        </div>';
            var $modal = $(html);

            $modal.find(".modal-title").html(params.title);
            $modal.find(":button:last").html(params.btnValue);
            this.children("*").appendTo($modal.find(".modal-body"));
            $modal.find(":button:last").off("click").on("click",params.addBind);
            $modal.appendTo(this);
        } else if("open"==params){
            this.find(".modal").modal("show");
        } else if("close"==params){
            this.find(".modal").modal("hide");
        }
    }
});